﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data.SqlClient;

/// <summary>
/// Summary description for City
/// </summary>
public class City :IBusinessEntity
{
    #region variables
    private string _cityID;
    private string _cityName;
    private string _description;
    #endregion

    #region Constructor
        public City()
        {
            _cityID=String.Empty;
            _cityName=String.Empty;
            _description=String.Empty;
        }
        public City(string cityID,string cityName,string description)
        {
            _cityID = cityID;
            _cityName = cityName;
            _description = description;
        }
    #endregion

    #region Property
        public string CityID
        {
            get { return _cityID; }
            set { _cityID = value; }
        }
        public string CityName
        {
            get { return _cityName; }
            set { _cityName = value; }
        }
        public string Description
        {
            get { return _description; }
            set { _description = value; }
        }
    #endregion

    #region Method
        public void Fill(SqlDataReader reader)
        {
            if (DAL.ColumnExists(reader, "CityID"))
            _cityID = reader.GetInt32(0).ToString();
            if (DAL.ColumnExists(reader, "CityName"))
            _cityName = reader.GetString(1);
            if (DAL.ColumnExists(reader, "Description") && !reader.IsDBNull(2))
            _description = reader.GetString(2);
        }
    #endregion

}
